package com.etop.service;

import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.etop.dao.UserDao;
import com.etop.pojo.User;

@SuppressWarnings("serial")
@Service("UserService")
public class UserService implements Serializable {
   @Autowired
   private UserDao userDao;
   public List getAllUsers(){
	   return userDao.find("from User");
   }
   public User findByName(String loginName){
	   Map<String,Object> params=new HashMap<String,Object>();
	   params.put("name", loginName);
	   User user=userDao.findUniqueResult("from User u where u.username=:name", params);
	   System.out.println("findByName:"+user.getPassword()+user.getUsername());
	   return user;
   }
}
